home *** CD-ROM | disk | FTP | other *** search
- ; Keygen for Terminal Cilla Newbie Challenge Volume 1
- ; by SiFLyiNG 20/08/99
- ;
- ;
-
- .Model Tiny
-
- .386
-
- .Data
-
- Intro Db 0Ah, 0Dh, 'Keygen for tC Newbie Challenge Volume 1 by SiFLyiNG'
- Db 0Ah, 0Dh
- Db 'Enter your name (at least 5 characters without space) : ', '$'
- Max Db 20h
- Lenght Db 0
- RegName Db 20h DUP (0)
- Serial Db 20h DUP (0),'$'
- Output Db 0Ah, 0Dh, 'Your serial is : ' ,'$'
- BadName Db 0Ah, 0Dh, 'Hey !!! Your name must be at least 5 chars long !!!','$'
- SpaceChar Db 0Ah, 0Dh, 'Hey !!! I told you WITHOUT space !!!','$'
- Line Db 0Ah, 0Dh,'$'
-
- .Code
- ORG 100h
-
- Main:
- Lea EDX, [Intro]
- Call Print
- Lea DX, [Max]
- Call Get
- Cmp byte ptr [lenght], 05 ; name > or = 5 chars ?
- Jae Next ; if lenght name > or = 5 then jump
-
- Lea DX, [BadName]
- Call Print
- Jmp Exit
- Next:
- Xor ecx, ecx
-
- ; This loop looks for any space characters in the name.
-
- SeekSpace:
- Movzx eax, byte ptr [RegName+ecx]
- Cmp al, 20h ; 20h = ascii value of space character
- Jnz OtherChar
- Lea DX, [SpaceChar] ; if there is a space in the name
- Call Print
- Jmp Exit
- OtherChar:
- Inc ecx
- Cmp cl, byte ptr [Lenght]
- Jnz SeekSpace
-
- ; this loop converts the name in upper case
- xor ecx, ecx
- UpperCase:
- Movzx eax, byte ptr [RegName+ecx]
- Cmp al, 61h
- Jb NextChar
- Cmp al, 7Ah
- Ja NextChar
- Sub al, 20h
- Mov byte ptr [RegName+ecx], al
- NextChar:
- Inc ecx
- Cmp cl,byte ptr [Lenght]
- Jnz UpperCase
-
- ; this loop calculates the valid serial
- Xor ecx, ecx
- Mov byte ptr [Serial], 31h
- Movzx ebx, byte ptr [Lenght]
- Dec ebx
- Calculation:
- Movzx eax, byte ptr [RegName+ecx]
- Push eax
- Movzx eax, byte ptr [Serial+ecx]
- Pop edx
- Add edx, eax
- Push edx
- Movzx eax, byte ptr [RegName+ecx+1]
- Pop edx
- Sub edx, eax
- Mov byte ptr [Serial+ecx+1], dl
- Inc ecx
- Cmp ecx, ebx
- jnz Calculation
-
- Finished:
- Lea DX, [Line]
- Call Print
- Lea DX, [Output]
- Call Print
- Lea DX, [Serial]
- Call Print
- Lea DX, [Line]
- Call Print
- Exit:
- Mov ax, 4C00h
- Int 21h
-
-
- Print Proc
- Mov AH, 09h
- Int 21h
- Ret
- Print Endp
-
- Get Proc
- Mov AH, 0Ah
- Int 21h
- Ret
- Get Endp
-
- End Main
-